package logic

import (
	"context"
	"user_srv/model/redis"

	"user_srv/internal/svc"
	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetSmsCodeLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGetSmsCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetSmsCodeLogic {
	return &GetSmsCodeLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *GetSmsCodeLogic) GetSmsCode(in *user.GetSmsCodeRequest) (*user.GetSmsCodeResponse, error) {
	// todo: 获取短信

	//获取短信
	code := redis.RedisGetSmsCode(in.Mobile, in.Sale)

	return &user.GetSmsCodeResponse{
		Code: code,
	}, nil
}
